#!/bin/bash

# 快速重启脚本 - 简化版本
echo "🔄 快速重启Spring Boot应用..."

# 停止现有进程
echo "🛑 停止现有进程..."
pkill -f "spring-boot:run" 2>/dev/null
lsof -ti:8081 | xargs kill -9 2>/dev/null
sleep 2

# 启动新进程
echo "🚀 启动新进程..."
/Users/shafei/Desktop/bgyfw-tcpt/maven/apache-maven-3.6.1-tcpt/bin/mvn spring-boot:run > app.log 2>&1 &

# 等待启动
echo "⏳ 等待启动..."
sleep 15

# 检查状态
if curl -s http://localhost:8081/api/monitor/machines >/dev/null 2>&1; then
    echo "✅ 重启成功! 访问: http://localhost:8081"
else
    echo "❌ 启动失败，请检查日志: app.log"
fi 